package com.nucarf.yc.app

import com.nucarf.yc.utils.KafkaUtil
import org.apache.flink.api.common.serialization.SimpleStringSchema
import org.apache.flink.streaming.api.TimeCharacteristic
import org.apache.flink.streaming.api.scala._
import org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumer

object Order2Hive {

  def main(args: Array[String]): Unit = {

    val env: StreamExecutionEnvironment = StreamExecutionEnvironment.getExecutionEnvironment

    /* 设置并行度 */
    env.setParallelism(1)

    /* 设置时间语义 */
    env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime)

    val inputStream: DataStream[String] =
      env.addSource( new FlinkKafkaConsumer[String](
        KafkaUtil.WJY_CON_ORDER_LOG,
        new SimpleStringSchema(),
        KafkaUtil.kafkaConsumerProperties()) )

    inputStream.print()

    env.execute("WJY_CON_ORDER_LOG : ")
  }
}
